import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 分佣关联用户信息 */
export interface BrokerageRoleBind {
          id: number; // 主键(自增策略)
          brokerageRoleId?: number; // 分佣配置ID
          userId?: number; // 用户编号
  }

// 分佣关联用户 API
export const BrokerageRoleBindApi = {
  // 查询分佣关联用户分页
  getBrokerageRoleBindPage: async (params: any) => {
    return await request.get({ url: `/system/brokerage-role-bind/page`, params })
  },

  // 查询分佣关联用户详情
  getBrokerageRoleBind: async (id: number) => {
    return await request.get({ url: `/system/brokerage-role-bind/get?id=` + id })
  },

  // 新增分佣关联用户
  createBrokerageRoleBind: async (data: BrokerageRoleBind) => {
    return await request.post({ url: `/system/brokerage-role-bind/create`, data })
  },

  // 修改分佣关联用户
  updateBrokerageRoleBind: async (data: BrokerageRoleBind) => {
    return await request.put({ url: `/system/brokerage-role-bind/update`, data })
  },

  // 删除分佣关联用户
  deleteBrokerageRoleBind: async (id: number) => {
    return await request.delete({ url: `/system/brokerage-role-bind/delete?id=` + id })
  },

  /** 批量删除分佣关联用户 */
  deleteBrokerageRoleBindList: async (ids: number[]) => {
    return await request.delete({ url: `/system/brokerage-role-bind/delete-list?ids=${ids.join(',')}` })
  },

  // 导出分佣关联用户 Excel
  exportBrokerageRoleBind: async (params) => {
    return await request.download({ url: `/system/brokerage-role-bind/export-excel`, params })
  }
}